<form method="POST" action="index.php?app=desktop&ctl=users&act=saveUser" class="tableform" id="form_user">
<div class="division">
        <table cellspacing="0" cellpadding="0" width="100%">
		<tbody>

		<tr><th><em class="red">*</em><label for="dom_el_3e40f70"><{t}>姓名：<{/t}></label></th><td><input type="text" vtype="required" id="dom_el_3e40f70" disable="true" value="<{$name}>" name="name" title="<{t}>姓名<{/t}>" class="x-input " autocomplete="off"/> <input type="button" onclick="new Dialog('index.php?ctl=users&act=chkpassword&id=<{$account_id}>',{width:400,height:300,title:'<{t}>密码修改<{/t}>'})" value="<{t}>修改密码<{/t}>" /></td></tr>
		<{if $ismyself != 'true'}><tr><th><em class="red">*</em><label for="dom_el_3e40f72"><{t}>启用：<{/t}></label></th><td><select id="dom_el_3e40f72" required="1" name="status" type="select" title="<{t}>启用<{/t}>" class="x-input-select inputstyle"><option value="0" <{if !$status}>selected="selected"<{/if}>><{t}>否<{/t}></option><option value="1" <{if $status}>selected="selected"<{/if}>><{t}>是<{/t}></option></select></td></tr><{/if}>

        <input type="hidden" value="<{$account_id}>" name="account_id" />
       <tr><th><td>
 	<div id="role" <{if !$super}>style="display:block"<{else}>style="display:none"<{/if}>><{t}>角色:<{/t}>
     <ul><{if !$super}><input type='hidden'  vtype='requiredcheckbox'/> <{/if}><{foreach from=$workgroup item=item}>
         <li><input class="role" type="checkbox" value='<{$item.role_id}>' name=role[<{$item.role_id}>] <{if $item.checked=='true'}>checked='checked'<{/if}>/>
<{$item.role_name}></li>
         <{/foreach}>
     </ul>
 </div> 
 <tr><th>
</th><td></td></tr>
</tbody>
</table>
 <div id="work" style="display:block"><{$per}></div>
</div>
     <div class="table-action">
	<{button type="button"  label=$___desktop="保存"|t:'desktop' id="user-submit"}>
</div>
</div>
</form>


<script>
(function(){
  
     $$('.role').addEvent('click',function(e){  
        	   var checkedEl = $ES('input.role:checked');
        	 
               var checkedName = [];
               checkedEl.each(function(cel,k){
                   checkedName[k] = encodeURIComponent(cel.value=cel.value.trim());   
               });
	           new Request.HTML({url:'index.php?app=desktop&ctl=users&act=detail_ground',method:'post',
			   update:$('work'),data:'checkedName='+JSON.encode(checkedName)+'&name='+encodeURIComponent(this.value=this.value.trim())         
	            }).send();
        });
       
	 if($('is_super'))
     $('is_super').addEvent('change',function(e){  
        	value = this.value;
        	if(value==0){
        		$('role').setStyle('display','block'); 
        		$('work').setStyle('display','block');
        	} 
        	else{
        		$('role').setStyle('display','none'); 
        		$('work').setStyle('display','none');
        	}       
            
        });
    
})();

</script>

<script>
(function(){
	var _form = $('form_user');
	var btn =$('user-submit');
	var finder = finderGroup['<{$env.get._finder.finder_id}>'];
	
	_form.store('target',{
		onSuccess:function(response){
			var hash_res_obj = JSON.decode(response);
		
			if (hash_res_obj.success != undefined && hash_res_obj.success != "")
			{
				try{
					var _dialogIns = btn.getParent('.dialog').retrieve('instance');
				}catch(e){}
				
				if(_dialogIns)
				{	
					_dialogIns.close();
					window.finderGroup['<{$env.get._finder.finder_id}>'].refresh();
				}
			}
			
		}
	});

	    btn.addEvent('click',function(){
		
		    _form.fireEvent('submit',{stop:$empty});
			
		
		
		});
	
})();
	
	
</script>

